package com.woniuxy.stage3demo.controller.controllerhpx;


import com.github.pagehelper.PageInfo;
import com.woniuxy.stage3demo.bean.hpxbean.ContractBean;
import com.woniuxy.stage3demo.pageHelper.PageRequest;
import com.woniuxy.stage3demo.pageHelper.TableResult;
import com.woniuxy.stage3demo.service.hpxservice.IContractService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/contract")
public class ContractController {

    @Resource
    private IContractService contractServiceImpl;

    //分页查询
    @RequestMapping(value = "/page",produces = {"application/json;charset=utf-8"})
    public TableResult<ContractBean> findAllByParams(PageRequest request, ContractBean contractBean){
        System.out.println(contractBean);

        PageInfo<ContractBean> pageInfo = contractServiceImpl.findAllByParams(request,contractBean);
        return  new TableResult<ContractBean>(pageInfo.getTotal(),pageInfo.getList());
    }

}
